<template>
  <div class="set_tcas">
    <el-form :model="setTca" label-width="100px" ref="setTcasForm" class="demo-ruleForm">
      <el-form-item label="产生对象" prop="object-name">
        <el-input v-model="setTca['object-name']" placeholder="请输入产生TCA对象标识"></el-input>
      </el-form-item>
      <el-form-item label="对象类型" prop="object-type">
        <el-select v-model="setTca['object-type']" placeholder="请选择事件产生对象类型" style="width: 100%"
                   class="select_devm">
          <el-option label="网元" value="ME"></el-option>
          <el-option label="单板" value="EQ"></el-option>
          <el-option label="端口" value="PTP"></el-option>
        </el-select>
      </el-form-item >
      <el-form-item label="性能参数" prop="pm-parameter-name">
        <el-cascader v-model="setTca['pm-parameter-name']" :options="options" style="width: 100%"
                     :show-all-levels="false"></el-cascader>
      </el-form-item>
      <el-form-item label="周期类型" prop="granularity">
        <el-select v-model="setTca.granularity" placeholder="请选择周期类型" style="width: 100%">
          <el-option
              v-for="(i,index) in granularity"
              :key="index"
              :value="i">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="性能门限值" prop="threshold-value">
        <el-input type="number" v-model="setTca['threshold-value']" placeholder="请输入性能门限值">
          <i slot="suffix" style="margin-right: 10px;">ms</i>
        </el-input>
      </el-form-item>
      <el-form-item label="高/低门限" prop="threshold-type">
        <el-select v-model="setTca['threshold-type']" placeholder="请选择高低门限标识" style="width: 100%">
          <el-option label="高" value="HIGH"></el-option>
          <el-option label="低" value="LOW"></el-option>
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary">确认</el-button>
        <el-button @click="resetForm('setTcasForm')">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "TcaParams",
  props: ['name'],
  data() {
    return {
      form: {
        date1: '',
        date2: '',
      },
      granularity: ['1min', '15min', '24h'],
      thresholdType: ['HIGH', 'LOW'],
      options: [
        {
          value: '',
          label: '以太网端口性能',
          children: [
            {
              value: 'RX_PKT_SUM',
              label: '接收的正常包数',
            },
            {
              value: 'rxBytes',
              label: '接收的正常包字节总数'
            },
            {
              value: 'RX_SUMMIT_1S',
              label: '接收的秒级峰值'
            },
            {
              value: 'TX_PKT_SUM',
              label: '发送的正常包数'
            },
            {
              value: 'txBytes',
              label: '发送的正常包字节总数'
            },
            {
              value: 'TX_SUMMIT_1S',
              label: '发送的秒级峰值'
            },
            {
              value: 'RX_CRC_ERR_SUM',
              label: '接收CRC错包数'
            },
          ]
        },
        {
          value: '',
          label: '以太客户层业务性能',
          children: [
            {
              value: 'delay',
              label: '双向时延'
            },
            {
              value: 'nearPacketLossRate',
              label: '近端丢包率'
            },
            {
              value: 'farPacketLossRate',
              label: '远端丢包率'
            },
          ]
        },
        {
          value: '',
          label: '光接口',
          children: [
            {
              value: 'OPT_OUTPOW',
              label: '输出光功率'
            },
            {
              value: 'OPT_INPUTPOW',
              label: '输入光功率'
            },
            {
              value: 'LD_BIAS',
              label: '激光器偏流'
            },
            {
              value: 'LASER_TMP',
              label: '激光器温度'
            },
            {
              value: 'LASER_FREQUNCY',
              label: '激光器频率'
            },
          ]
        },
        {
          value: '',
          label: 'g.metro',
          children: [
            {
              value: 'TEE_LINE_TXPOWER',
              label: 'TEE输出光功率'
            },
            {
              value: 'TEE_LINE_RXPOWER',
              label: 'TEE输入光功率'
            },
            {
              value: 'TEE_LINE_BIAS_CURRENT',
              label: 'TEE激光器偏流'
            },
            {
              value: 'TEE_LINE_TEMPERATURE',
              label: 'TEE激光器温度'
            },
            {
              value: 'TEE_LINE_LASER_FREQUNCY',
              label: 'TEE激光器频率'
            },
            {
              value: 'TEE_CLIENT_TXPOWER',
              label: 'TEE CLIENT输出光功率'
            },
            {
              value: 'TEE_CLIENT_RXPOWER',
              label: 'TEE CLIENT输入光功率'
            },
            {
              value: 'TEE_CLIENT_BIAS_CURRENT',
              label: 'TEE CLIENT激光器偏流'
            },
            {
              value: 'TEE_CLIENT_TEMPERATURE',
              label: 'TEE CLIENT激光器温度'
            },
            {
              value: 'TEE_CLIENT_LASER_FREQUNCY',
              label: 'TEE CLIENT激光器频率'
            },
          ]
        },
        {
          value: '',
          label: 'SDH业务再生段性能',
          children: [
            {
              value: 'RS_ES',
              label: 'RS误码秒'
            },
            {
              value: 'RS_SES',
              label: 'RS严重误码秒'
            },
            {
              value: 'RS_UAS',
              label: 'RS不可用时间'
            },
            {
              value: 'RS_CV',
              label: 'RS误码数'
            },
            {
              value: 'RS_BBE',
              label: 'RS BBE背景块误码个数'
            },
          ]
        },
        {
          value: '',
          label: 'ODUk的PM性能',
          children: [
            {
              value: 'PM_BBE',
              label: 'PM 背景块误码'
            },
            {
              value: 'PM_BBER',
              label: 'PM 背景块误码比（可选）'
            },
            {
              value: 'PM_ES',
              label: 'PM 误码秒'
            },
            {
              value: 'PM_SES',
              label: 'PM 严重误码秒'
            },
            {
              value: 'PM_SESR',
              label: 'PM 严重误码秒比（可选）'
            },
            {
              value: 'PM_UAS',
              label: 'PM 不可用秒'
            },
            {
              value: 'PM_FEBBE',
              label: 'PM 远端背景块误码'
            },
            {
              value: 'PM_FEBBER',
              label: 'PM 远端背景块误码比（可选）'
            },
            {
              value: 'PM_FEESPM_FEES',
              label: 'PM 远端误码秒'
            },
            {
              value: 'PM_FESES',
              label: 'PM 远端严重误码秒'
            },
            {
              value: 'PM_FEUAS',
              label: 'PM 远端不可用秒'
            },
            {
              value: 'PM_FESESR',
              label: 'PM 远端严重误码秒比（可选）'
            },
          ]
        },
        {
          value: '',
          label: 'ODUk的TCM 性能\n' +
              '（仅适用于插卡式设备）',
          children: [
            {
              value: 'TCMi_BBE',
              label: 'TCMi 背景误码块'
            },
            {
              value: 'TCMi_BBER',
              label: 'TCMi 背景误码块比（可选）'
            },
            {
              value: 'TCMi_BIAES',
              label: 'TCMi 后向输入定位误码秒'
            },
            {
              value: 'TCMi_IAES',
              label: 'TCMi 输入定位误码秒'
            },
            {
              value: 'TCMi_ES',
              label: 'TCMi 误码秒'
            },
            {
              value: 'TCMi_SES',
              label: 'TCMi 严重误码秒'
            },
            {
              value: 'TCMi_SESR',
              label: 'TCMi 严重误码秒比（可选）'
            },
            {
              value: 'TCMi_UAS',
              label: 'TCMi 不可用秒'
            },
            {
              value: 'TCMi_FEBBE',
              label: 'TCMi 远端背景块误码'
            },
            {
              value: 'TCMi_FEBBER',
              label: 'TCMi 远端背景块误码比（可选）'
            },
            {
              value: 'TCMi_FEES',
              label: 'TCMi 远端误码秒'
            },
            {
              value: 'TCMi_FESES',
              label: 'TCMi 远端严重误码秒'
            },
            {
              value: 'TCMi_FESESR',
              label: 'TCMi 远端严重误码秒比（可选）'
            },
            {
              value: 'TCMi_FEUAS',
              label: 'TCMi 远端不可用秒'
            },
          ]
        },
        {
          value: '',
          label: 'OTU SM段性能',
          children: [
            {
              value: 'SM_BBE',
              label: 'SM 背景误码块'
            },
            {
              value: 'SM_BBER',
              label: 'SM 背景误码块比（可选）'
            },
            {
              value: 'SM_BIAES',
              label: 'SM 后向输入定位误码秒'
            },
            {
              value: 'SM_IAES',
              label: 'SM 输入定位误码秒'
            },
            {
              value: 'SM_ES',
              label: 'SM 误码秒'
            },
            {
              value: 'SM_SES',
              label: 'SM 严重误码秒'
            },
            {
              value: 'SM_SESR',
              label: 'SM 严重误码秒比（可选）'
            },
            {
              value: 'SM_UAS',
              label: 'SM 不可用秒'
            },
            {
              value: 'SM_FEBBE',
              label: 'SM 远端背景块误码'
            },
            {
              value: 'SM_FEBBER',
              label: 'SM 远端背景块误码比（可选）'
            },
            {
              value: 'SM_FEES',
              label: 'SM 远端误码秒'
            },
            {
              value: 'SM_FESES',
              label: 'SM 远端严重误码秒'
            },
            {
              value: 'SM_FESESR',
              label: 'SM 远端严重误码秒比（可选）'
            },
            {
              value: 'SM_FEUAS',
              label: 'SM 远端不可用秒'
            },
            {
              value: 'FEC_CORRECT_ERROR',
              label: 'FEC纠正的误码数'
            },
            {
              value: 'UNCORRECT_FRAME',
              label: 'FEC不可纠正的帧'
            },
            {
              value: 'BER_BEFORE_FEC',
              label: 'FEC纠错前误码率'
            },
          ]
        },
        {
          value: '',
          label: '其他性能',
          children: [
            {
              value: 'BRD_CPU_USAGE',
              label: '板卡CPU利用率'
            },
            {
              value: 'BRD_MEMORY_USAGE',
              label: '板卡内存利用率'
            },
          ]
        },
      ],
      'setTca': {
        "object-name": "PTP=/shelf=1/slot=8/subslot=1/port=101",
        "pm-parameter-name": "",
        "granularity": "",
        "threshold-type": "",
        "object-type": "",
        "threshold-value": "-23.98"
      },
      //查询性能越限阈值
      getTca: {
        objectName: '',
        granularity: '',
        pmParameterName: '',
      },
      tableData: {
        "tca-parameters": {
          "tca-parameter": [
            {
              "object-name": "PTP=/shelf=1/slot=8/subslot=1/port=101",
              "pm-parameter-name": "OPT_INPUTPOW",
              "granularity": "1min",
              "threshold-type": "low",
              "object-type": "PTP",
              "threshold-value": "-23.98"
            }
          ]
        }
      },
      //查询当前性能
      getCurrentPerformances: {
        objectName: '',
        granularity: '',
        pmParameterName: '',
        starTime: '',
      },
      currentPerformances: [{
        "object-name": "PTP=/shelf=1/slot=8/subslot=1/port=101",
        "granularity": "15min",
        "pm-parameter-name": "RX_PKT_SUM",
        "digital-pm-value": '',
        "analog-pm-value": {
          'max-value': '',
          'min-value': '',
          'average-value': '',
          'current-value': ''
        },
        "start-time": "2022-04-07T09:18:18Z ",
        "end-time": "2022-04-08T09:18:18Z "
      }]

    }
  },
  methods:{
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
}
</script>

<style scoped>

</style>